package com.rfqx.controller.customer;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rfqx.entity.Customer;
import com.rfqx.service.CustomerService;

@WebServlet("/customer/list")
public class CustomersController extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest request
					  , HttpServletResponse response)
			throws ServletException, IOException {

		
		CustomerService service = new CustomerService();
	 	List<Customer> customers = service.listAll();
	 	
	 	request.setAttribute("customers", customers);
	 		
	 	request.getRequestDispatcher("/WEB-INF/jsp/customer/list.jsp")
	 		   .forward(request, response);
	
	}
	
}
